package com.sunshine.student_register.ui.activity.main;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import com.sunshine.student_register.ui.fragment.note.NoteFragment;
import com.sunshine.student_register.ui.fragment.register.RegisterFragment;

import java.util.ArrayList;

/**
 * @author sunshine
 * @date 2020/5/30
 * 主活动viewpager界面适配器，所有要添加的界面在这里new
 * 这里创建了签到和记录界面
 */
public class MainAdapter extends FragmentPagerAdapter {

    private ArrayList<Fragment> fragmentArrayList;

    MainAdapter(@NonNull FragmentManager fm) {
        super(fm);

        fragmentArrayList = new ArrayList<>();
        fragmentArrayList.add(new RegisterFragment());
        fragmentArrayList.add(new NoteFragment());
    }

    @NonNull
    @Override
    public Fragment getItem(int position) {
        return fragmentArrayList.get(position);
    }

    @Override
    public int getCount() {
        return fragmentArrayList.size();
    }
}
